//
//  YYQiniuExtension.swift
//  YYProject
//
//  Created by 陆文宇 on 2017/9/5.
//  Copyright © 2017年 陆文宇. All rights reserved.
//

import Foundation

extension YYQiniu {
    
    static func getToken(_ completionHandler: @escaping (String) -> Void) {
        yy_post(url: apiUrlPrex + "/qiniu/token", parameters: ["bucket": "lmmteam"], success: { (data) in
            if let token = (data as? [String: Any])?["token"] as? String {
                completionHandler(token)
            } else {
                SVProgressHUD.showError(with: "未能获取到上传凭证")
            }
        }) { (errmsg) in
            return errmsg
        }
    }
    
}
